﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
	xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
	xmlns:ssentities="clr-namespace:SIPSorcery.Entities;assembly=SIPSorcery.Entities.Client"
	xmlns:app="clr-namespace:SIPSorcery.App;assembly=SIPSorcery" 
	xmlns:sipsorceryui="clr-namespace:SIPSorcery.UIControls"
	mc:Ignorable="d"
	x:Class="SIPSorcery.DialPlanWizard" Width="1024" Height="449" Background="Black">

	<UserControl.Resources>
		<ssentities:CountriesList x:Key="CountriesList" />
	</UserControl.Resources>

	<Border x:Name="LayoutRoot" Background="Black" Width="1020" BorderThickness="1" BorderBrush="#FFA0F927" CornerRadius="5" Margin="0">
		<StackPanel Margin="0">
			<Canvas Height="26" Margin="8,0">
				<Button Content="X" x:Name="m_closeButton" Click="CloseButton_Click" Width="23" Height="20" Canvas.Left="977" Canvas.Top="5" />
			</Canvas>
			<sdk:TabControl Margin="8,0" Height="417" SelectionChanged="TabControl_SelectionChanged">
				<sdk:TabControl.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF3A3838"/>
						<GradientStop Color="Black" Offset="1"/>
					</LinearGradientBrush>
				</sdk:TabControl.Background>
				<sdk:TabItem Header="Speed Dials">
					<Grid Background="Black">
						<sipsorceryui:AssetViewPanel Height="375" x:Name="m_speedDialsPanel" Width="710" Margin="5,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
							<sdk:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_speedDialsDataGrid" AutoGenerateColumns="False" FontSize="11" 
								RowBackground="Azure"
								AlternatingRowBackground="LightSteelBlue" Margin="0,5,0,0" HorizontalAlignment="Left" Width="710" SelectionChanged="SpeedDialsDataGrid_SelectionChanged" MinHeight="231">
								<sdk:DataGrid.Columns>
									<sdk:DataGridTextColumn 
										Header="Speed Dial" 
										Width="SizeToCells"
										Binding="{Binding LookupKey}" 
										IsReadOnly="True"
										MinWidth="130"/>
									<sdk:DataGridTextColumn 
										Header="Destination" 
										Width="SizeToCells"
										Binding="{Binding LookupValue}" 
										IsReadOnly="True"
										MinWidth="190" />
									<sdk:DataGridTextColumn 
										Header="Description" 
										Width="SizeToCells"
										Binding="{Binding Description}" 
										IsReadOnly="True"
										MinWidth="280"
										MaxWidth="280" />
									<!--<data:DataGridTemplateColumn Header="Delete" MinWidth="100">
											<data:DataGridTemplateColumn.CellTemplate>
												<DataTemplate>
													<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteSpeedDial" HorizontalAlignment="Center" />
												</DataTemplate>
											</data:DataGridTemplateColumn.CellTemplate>
										</data:DataGridTemplateColumn>-->
								</sdk:DataGrid.Columns>
							</sdk:DataGrid>
							<Border x:Name="m_speedDialHelpCanvas" Background="#FFFAF0B9" Margin="0,5,0,0" CornerRadius="3" Height="110">
								<Grid>
									<TextBlock Height="22" TextWrapping="Wrap" Text="Speed Dials Help" Width="158" FontSize="16" HorizontalAlignment="Left" Margin="18,3,0,0" VerticalAlignment="Top" TextDecorations="Underline"/>
									<Button Content="X" Height="22" Width="27" Click="CloseSpeedDialHelp_Clicked" HorizontalAlignment="Right" Margin="0,4,4,0" VerticalAlignment="Top"/>
									<TextBlock TextWrapping="Wrap" FontSize="13.333" Margin="18,26,8,43"><Run Text="Speed dials are numbers you can set for commonly called destinations such as family members. They save the need to dial full numbers and make it easier to place frequently "/><Run Text="dialed"/><Run Text=" calls."/><LineBreak/><Run/></TextBlock>
									<TextBlock Height="22" TextWrapping="Wrap" Text="Example:" Width="76" FontSize="16" HorizontalAlignment="Left" Margin="18,0,0,21" VerticalAlignment="Bottom"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="113,0,0,20" TextWrapping="Wrap" Text="Speed Dial" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="228,0,0,20" TextWrapping="Wrap" Text="Destination" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Right" Height="18" Margin="0,0,229,20" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"><Run Text="Des"/><Run Text="cription"/></TextBlock>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="113,0,0,3" TextWrapping="Wrap" Text="100" VerticalAlignment="Bottom" Width="83" FontWeight="Bold"/>
									<TextBlock Height="18" Margin="231,0,341,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold"><Run Text="prez"/><Run Text="@sipsorcery.com"/></TextBlock>
									<TextBlock Height="18" Margin="0,0,17,3" TextWrapping="Wrap" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="295" FontWeight="Bold" Text="Hotline to The Prez!"/>
								</Grid>
							</Border>
						</sipsorceryui:AssetViewPanel>
						<toolkit:DataForm x:Name="m_speedDialsDataForm" HorizontalAlignment="Right" Margin="0,36,4,8" Width="263" CommandButtonsVisibility="Add,Commit,Cancel,Delete,Navigation" AutoGenerateFields="False" 
							AutoEdit="True" AutoCommit="False" EditEnding="EditEndingLookup" EditEnded="EditEnded"
							Header="" DeletingItem="DeleteSpeedDial">
							<toolkit:DataForm.EditTemplate>
								<DataTemplate>
									<StackPanel>
										<TextBlock Text="Speed Dial" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupKey, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Destination" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupValue, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Description" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="50" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding Description, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" TextWrapping="Wrap"/>
										</toolkit:DataField>
									</StackPanel>
								</DataTemplate>
							</toolkit:DataForm.EditTemplate>
						</toolkit:DataForm>
					</Grid>
				</sdk:TabItem>
				<sdk:TabItem Header="Dial Plan Providers">
					<Grid Background="Black">
						<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_providersPanel" Width="710" Margin="5,5,0,0" HorizontalAlignment="Left">
							<sdk:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_providersDataGrid" AutoGenerateColumns="False" FontSize="11" 
								RowBackground="Azure"
								AlternatingRowBackground="LightSteelBlue" Margin="0,5,0,0" HorizontalAlignment="Left" Width="710" SelectionChanged="ProvidersDataGrid_SelectionChanged" MinHeight="231">
								<sdk:DataGrid.Columns>
									<sdk:DataGridTextColumn 
										Header="Name" 
										Width="SizeToCells"
										Binding="{Binding ProviderName}" 
										IsReadOnly="True"
										MinWidth="130"/>
									<sdk:DataGridTextColumn 
										Header="Prefix" 
										Width="SizeToCells"
										Binding="{Binding ProviderPrefix}" 
										IsReadOnly="True"
										MinWidth="80" />
									<sdk:DataGridTextColumn 
										Header="Destination" 
										Width="SizeToCells"
										Binding="{Binding ProviderDialString}" 
										IsReadOnly="True"
										MinWidth="180" />
									<sdk:DataGridTextColumn 
										Header="Description" 
										Width="SizeToCells"
										Binding="{Binding ProviderDescription}" 
										IsReadOnly="True"
										MinWidth="180" />
									<!--<sdk:DataGridTemplateColumn Header="Delete" MinWidth="100">
											<sdk:DataGridTemplateColumn.CellTemplate>
												<DataTemplate>
													<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteENUM" HorizontalAlignment="Center" />
												</DataTemplate>
											</sdk:DataGridTemplateColumn.CellTemplate>
										</sdk:DataGridTemplateColumn>-->
								</sdk:DataGrid.Columns>
							</sdk:DataGrid>
							<Border x:Name="m_dialplanProvidersHelpCanvas" Background="#FFFAF0B9" Margin="0,5,0,0" CornerRadius="3" Height="110">
								<Grid>
									<TextBlock Height="22" TextWrapping="Wrap" Width="197" FontSize="16" HorizontalAlignment="Left" Margin="18,3,0,0" VerticalAlignment="Top" TextDecorations="Underline"><Run Text="Dial"/><Run Text=" Plan Provider"/><Run Text="s Help"/></TextBlock>
									<Button Content="X" Height="22" Width="27" Click="CloseDialPlanProvidersHelp_Clicked" HorizontalAlignment="Right" Margin="0,4,4,0" VerticalAlignment="Top"/>
									<TextBlock TextWrapping="Wrap" FontSize="13.333" Margin="18,26,8,43" Text="Dial plan providers are the SIP providers you can use in a route. A prefix can also be specified for a provider to force a call through it."/>
									<TextBlock Height="22" TextWrapping="Wrap" Text="Example:" Width="76" FontSize="16" HorizontalAlignment="Left" Margin="18,0,0,21" VerticalAlignment="Bottom"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="98,0,0,20" TextWrapping="Wrap" Text="Name" VerticalAlignment="Bottom" Width="66" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="245,0,0,20" TextWrapping="Wrap" Text="Destination" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Right" Height="18" Margin="0,0,229,20" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"><Run Text="Des"/><Run Text="cription"/></TextBlock>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="99,0,0,3" TextWrapping="Wrap" Text="ProviderX" VerticalAlignment="Bottom" Width="65" FontWeight="Bold"/>
									<TextBlock Height="18" Margin="245,0,326,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold" Text="${EXTEN}@sip.com"/>
									<TextBlock Height="18" Margin="0,0,17,3" TextWrapping="Wrap" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="295" FontWeight="Bold"><Run Text="ProviderX "/><Run Text="is "/><Run Text="good for calls to USA."/></TextBlock>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="185,0,0,20" TextWrapping="Wrap" Text="Prefix" VerticalAlignment="Bottom" Width="44" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="188,0,0,3" TextWrapping="Wrap" Text="#1" VerticalAlignment="Bottom" Width="42" FontWeight="Bold"/>
								</Grid>
							</Border>
						</sipsorceryui:AssetViewPanel>
						<toolkit:DataForm x:Name="m_providersDataForm" HorizontalAlignment="Right" Margin="0,36,4,8" Width="263" CommandButtonsVisibility="Add,Commit,Cancel,Delete,Navigation" AutoGenerateFields="False" 
							AutoEdit="True" AutoCommit="False" EditEnding="EditEndingProvider" EditEnded="EditEnded"
							Header="" DeletingItem="DeleteDialPlanProvider">
							<toolkit:DataForm.EditTemplate>
								<DataTemplate>
									<StackPanel>
										<TextBlock Text="Name" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ProviderName, Mode=TwoWay}"
												VerticalAlignment="Top" Width="200" />
										</toolkit:DataField>
										<TextBlock Text="Prefix" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ProviderPrefix, Mode=TwoWay}"
												VerticalAlignment="Top" Width="60" />
										</toolkit:DataField>
										<TextBlock Text="Destination" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ProviderDialString, Mode=TwoWay}"
												VerticalAlignment="Top" Width="200" />
										</toolkit:DataField>
										<TextBlock Text="Description" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="50" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ProviderDescription, Mode=TwoWay}"
												VerticalAlignment="Top" Width="200" TextWrapping="Wrap"/>
										</toolkit:DataField>
									</StackPanel>
								</DataTemplate>
							</toolkit:DataForm.EditTemplate>
						</toolkit:DataForm>
					</Grid>
				</sdk:TabItem>
				<sdk:TabItem Header="Routes">
					<Grid Background="Black">
							<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_routesPanel" Width="710" Margin="5,5,0,0" HorizontalAlignment="Left">
								<sdk:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_routesDataGrid" AutoGenerateColumns="False" FontSize="11" 
									RowBackground="Azure"
									AlternatingRowBackground="LightSteelBlue" Margin="0,5,0,0" HorizontalAlignment="Left" Width="710" SelectionChanged="RoutesDataGrid_SelectionChanged" MinHeight="231">
									<sdk:DataGrid.Columns>
										<sdk:DataGridTextColumn 
											Header="Name" 
											Width="SizeToCells"
											Binding="{Binding RouteName}" 
											IsReadOnly="True"
											MinWidth="130"/>
										<sdk:DataGridTextColumn 
											Header="Pattern" 
											Width="SizeToCells"
											Binding="{Binding RoutePattern}" 
											IsReadOnly="True"
											MinWidth="80" />
										<sdk:DataGridTextColumn 
											Header="Destination" 
											Width="SizeToCells"
											Binding="{Binding RouteDestination}" 
											IsReadOnly="True"
											MinWidth="180" />
										<sdk:DataGridTextColumn 
											Header="Description" 
											Width="SizeToCells"
											Binding="{Binding RouteDescription}" 
											IsReadOnly="True"
											MinWidth="180" />
										<!--<sdk:DataGridTemplateColumn Header="Delete" MinWidth="100">
												<sdk:DataGridTemplateColumn.CellTemplate>
													<DataTemplate>
														<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteENUM" HorizontalAlignment="Center" />
													</DataTemplate>
												</sdk:DataGridTemplateColumn.CellTemplate>
											</sdk:DataGridTemplateColumn>-->
									</sdk:DataGrid.Columns>
								</sdk:DataGrid>
								<Border x:Name="m_routesHelpCanvas" Background="#FFFAF0B9" Margin="0,5,0,0" CornerRadius="3" Height="110">
									<Grid>
										<TextBlock Height="22" TextWrapping="Wrap" Width="197" FontSize="16" HorizontalAlignment="Left" Margin="18,3,0,0" VerticalAlignment="Top" TextDecorations="Underline"><Run Text="Routes "/><Run Text="Help"/></TextBlock>
										<Button Content="X" Height="22" Width="27" Click="CloseRoutesHelp_Clicked" HorizontalAlignment="Right" Margin="0,4,4,0" VerticalAlignment="Top"/>
										<TextBlock TextWrapping="Wrap" FontSize="13.333" Margin="18,26,8,43"><Run Text="Routes are what determine how outgoing calls to the dial plan will be forwarded."/><Run Text=" The route pattern can be a regular expression "/><Run Text="or a prefix to match the start of a number"/><Run Text="."/></TextBlock>
										<TextBlock Height="22" TextWrapping="Wrap" Text="Example:" Width="76" FontSize="16" HorizontalAlignment="Left" Margin="18,0,0,21" VerticalAlignment="Bottom"/>
										<TextBlock HorizontalAlignment="Left" Height="18" Margin="99,0,0,20" TextWrapping="Wrap" Text="Name" VerticalAlignment="Bottom" Width="51" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
										<TextBlock HorizontalAlignment="Left" Height="18" Margin="239,0,0,20" TextWrapping="Wrap" Text="Destination" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
										<TextBlock Height="18" Margin="350,0,277,20" TextWrapping="Wrap" VerticalAlignment="Bottom" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"><Run Text="Des"/><Run Text="cription"/></TextBlock>
										<TextBlock HorizontalAlignment="Left" Height="18" Margin="100,0,0,3" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="51" FontWeight="Bold"><Run Text="To"/><Run Text="USA"/></TextBlock>
										<TextBlock Height="18" Margin="240,0,332,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold" Text="ProviderX"/>
										<TextBlock Height="18" Margin="353,0,21,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold" Text="ProviderX offers the cheapest calls to the USA."/>
										<TextBlock HorizontalAlignment="Left" Height="18" Margin="164,0,0,20" TextWrapping="Wrap" Text="Pattern" VerticalAlignment="Bottom" Width="51" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
										<TextBlock HorizontalAlignment="Left" Height="18" Margin="165,0,0,3" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="51" FontWeight="Bold" Text="001"/>
									</Grid>
								</Border>
							</sipsorceryui:AssetViewPanel>
							<toolkit:DataForm x:Name="m_routesDataForm" HorizontalAlignment="Right" Margin="0,36,4,8" Width="263" CommandButtonsVisibility="Add,Commit,Cancel,Delete,Navigation" AutoGenerateFields="False" 
								AutoEdit="True" AutoCommit="False" EditEnding="EditEndingRoute" EditEnded="EditEnded"
								Header="" DeletingItem="DeleteRoute">
								<toolkit:DataForm.EditTemplate>
									<DataTemplate>
										<StackPanel>
											<TextBlock Text="Name" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding RouteName, Mode=TwoWay}"
													VerticalAlignment="Top" Width="200" />
											</toolkit:DataField>
											<TextBlock Text="Pattern" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding RoutePattern, Mode=TwoWay}"
													VerticalAlignment="Top" Width="200" />
											</toolkit:DataField>
											<TextBlock Text="Destination" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding RouteDestination, Mode=TwoWay}"
													VerticalAlignment="Top" Width="200" />
											</toolkit:DataField>
											<TextBlock Text="Description" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="50" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding RouteDescription, Mode=TwoWay}"
													VerticalAlignment="Top" Width="200" TextWrapping="Wrap"/>
											</toolkit:DataField>
										</StackPanel>
									</DataTemplate>
								</toolkit:DataForm.EditTemplate>
							</toolkit:DataForm>
						</Grid>	
				</sdk:TabItem>
				<sdk:TabItem Header="ENUM">
					<Grid Background="Black">
						<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_enumsPanel" Width="710" Margin="5,5,0,0" HorizontalAlignment="Left">
							<sdk:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_enumsDataGrid" AutoGenerateColumns="False" FontSize="11" 
								RowBackground="Azure"
								AlternatingRowBackground="LightSteelBlue" Margin="0,5,0,0" HorizontalAlignment="Left" Width="710" SelectionChanged="ENUMsDataGrid_SelectionChanged" MinHeight="231">
								<sdk:DataGrid.Columns>
									<sdk:DataGridTextColumn 
										Header="Outgoing Number" 
										Width="SizeToCells"
										Binding="{Binding LookupKey}" 
										IsReadOnly="True"
										MinWidth="130"/>
									<sdk:DataGridTextColumn 
										Header="Destination" 
										Width="SizeToCells"
										Binding="{Binding LookupValue}" 
										IsReadOnly="True"
										MinWidth="190" />
									<sdk:DataGridTextColumn 
										Header="Description" 
										Width="SizeToCells"
										Binding="{Binding Description}" 
										IsReadOnly="True"
										MinWidth="280"
										MaxWidth="280" />
									<!--<sdk:DataGridTemplateColumn Header="Delete" MinWidth="100">
											<sdk:DataGridTemplateColumn.CellTemplate>
												<DataTemplate>
													<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteENUM" HorizontalAlignment="Center" />
												</DataTemplate>
											</sdk:DataGridTemplateColumn.CellTemplate>
										</sdk:DataGridTemplateColumn>-->
								</sdk:DataGrid.Columns>
							</sdk:DataGrid>
							<Border x:Name="m_enumHelpCanvas" Background="#FFFAF0B9" Margin="0,5,0,0" CornerRadius="3" Height="110">
								<Grid>
									<TextBlock Height="22" TextWrapping="Wrap" Width="197" FontSize="16" HorizontalAlignment="Left" Margin="18,3,0,0" VerticalAlignment="Top" TextDecorations="Underline"><Run Text="ENUM"/><Run Text=" "/><Run Text="Help"/></TextBlock>
									<Button Content="X" Height="22" Width="27" Click="CloseEnumHelp_Clicked" HorizontalAlignment="Right" Margin="0,4,4,0" VerticalAlignment="Top"/>
									<TextBlock TextWrapping="Wrap" FontSize="13.333" Margin="18,26,8,43"><Run Text="Outgoing number mapping (ENUM) allows PSTN calls to be mapped to a SIP call. The main advantage of ENUM mappings is that PSTN call legs can be replaced with free SIP ones."/><LineBreak/><Run/></TextBlock>
									<TextBlock Height="22" TextWrapping="Wrap" Text="Example:" Width="76" FontSize="16" HorizontalAlignment="Left" Margin="18,0,0,21" VerticalAlignment="Bottom"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="97,0,0,20" TextWrapping="Wrap" Text="Outgoing Number" VerticalAlignment="Bottom" Width="118" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="222,0,0,20" TextWrapping="Wrap" Text="Destination" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Right" Height="18" Margin="0,0,262,20" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"><Run Text="Des"/><Run Text="cription"/></TextBlock>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="98,0,0,3" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="83" FontWeight="Bold"><Run FontFamily="Verdana, Arial, Arial Unicode MS, Lucida Sans Unicode, Lucida Grande" Text="12345678"/></TextBlock>
									<TextBlock Height="18" Margin="223,0,349,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold"><Run Text="p"/><Run Text="rez"/><Run Text="@sipsorcery.com"/></TextBlock>
									<TextBlock Height="18" Margin="0,0,8,3" TextWrapping="Wrap" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="338" FontWeight="Bold" Text="Save on calls to the prez by using secret SIP address."/>
								</Grid>
							</Border>
						</sipsorceryui:AssetViewPanel>
						<toolkit:DataForm x:Name="m_enumsDataForm" HorizontalAlignment="Right" Margin="0,36,4,8" Width="263" CommandButtonsVisibility="Add,Commit,Cancel,Delete,Navigation" AutoGenerateFields="False" 
							AutoEdit="True" AutoCommit="False" EditEnding="EditEndingLookup" EditEnded="EditEnded"
							Header="" DeletingItem="DeleteENUM">
							<toolkit:DataForm.EditTemplate>
								<DataTemplate>
									<StackPanel>
										<TextBlock Text="Outgoing Number" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupKey, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Destination" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupValue, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Description" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="50" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding Description, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" TextWrapping="Wrap"/>
										</toolkit:DataField>
									</StackPanel>
								</DataTemplate>
							</toolkit:DataForm.EditTemplate>
						</toolkit:DataForm>
					</Grid>
				</sdk:TabItem>
				<sdk:TabItem Header="CNAM">
					<Grid Background="Black">
						<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_cnamPanel" Width="710" Margin="5,5,0,0" HorizontalAlignment="Left">
							<sdk:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_cnamDataGrid" AutoGenerateColumns="False" FontSize="11" 
								RowBackground="Azure"
								AlternatingRowBackground="LightSteelBlue" Margin="0,5,0,0" HorizontalAlignment="Left" Width="710" SelectionChanged="CNAMsDataGrid_SelectionChanged" MinHeight="231">
								<sdk:DataGrid.Columns>
									<sdk:DataGridTextColumn 
										Header="Incoming Number" 
										Width="SizeToCells"
										Binding="{Binding LookupKey}" 
										IsReadOnly="True"
										MinWidth="130"/>
									<sdk:DataGridTextColumn 
										Header="Caller Name" 
										Width="SizeToCells"
										Binding="{Binding LookupValue}" 
										IsReadOnly="True"
										MinWidth="190" />
									<sdk:DataGridTextColumn 
										Header="Description" 
										Width="SizeToCells"
										Binding="{Binding Description}" 
										IsReadOnly="True"
										MinWidth="280"
										MaxWidth="280" />
									<!--<sdk:DataGridTemplateColumn Header="Delete" MinWidth="100">
											<sdk:DataGridTemplateColumn.CellTemplate>
												<DataTemplate>
													<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteENUM" HorizontalAlignment="Center" />
												</DataTemplate>
											</sdk:DataGridTemplateColumn.CellTemplate>
										</sdk:DataGridTemplateColumn>-->
								</sdk:DataGrid.Columns>
							</sdk:DataGrid>
							<Border x:Name="m_cnamHelpCanvas" Background="#FFFAF0B9" Margin="0,5,0,0" CornerRadius="3" Height="110">
								<Grid>
									<TextBlock Height="22" TextWrapping="Wrap" Width="197" FontSize="16" HorizontalAlignment="Left" Margin="18,3,0,0" VerticalAlignment="Top" TextDecorations="Underline"><Run Text="CNAM"/><Run Text=" "/><Run Text="Help"/></TextBlock>
									<Button Content="X" Height="22" Width="27" Click="CloseCNAMHelp_Clicked" HorizontalAlignment="Right" Margin="0,4,4,0" VerticalAlignment="Top"/>
									<TextBlock TextWrapping="Wrap" FontSize="13.333" Margin="18,26,8,43" Text="Calling Name (CNAM) refers to the caller ID on a call. The CNAM table allows incoming caller ID's to be mapped to recognisable descriptions."/>
									<TextBlock Height="22" TextWrapping="Wrap" Text="Example:" Width="76" FontSize="16" HorizontalAlignment="Left" Margin="18,0,0,21" VerticalAlignment="Bottom"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="113,0,0,20" TextWrapping="Wrap" Text="Incoming Number" VerticalAlignment="Bottom" Width="117" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="252,0,0,20" TextWrapping="Wrap" Text="Caller Name" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"/>
									<TextBlock HorizontalAlignment="Right" Height="18" Margin="0,0,248,20" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="83" Foreground="{StaticResource SelectedTextBrush}" FontWeight="Bold"><Run Text="Des"/><Run Text="cription"/></TextBlock>
									<TextBlock HorizontalAlignment="Left" Height="18" Margin="113,0,0,3" TextWrapping="Wrap" Text="12345678" VerticalAlignment="Bottom" Width="102" FontWeight="Bold"/>
									<TextBlock Height="18" Margin="253,0,0,3" TextWrapping="Wrap" VerticalAlignment="Bottom" FontWeight="Bold" HorizontalAlignment="Left" Width="95"><Run Text="The Pr"/><Run Text="ez"/></TextBlock>
									<TextBlock Height="18" Margin="0,0,23,3" TextWrapping="Wrap" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="305" FontWeight="Bold" Text="Call from that pesky president fellow."/>
								</Grid>
							</Border>
						</sipsorceryui:AssetViewPanel>
						<toolkit:DataForm x:Name="m_cnamDataForm" HorizontalAlignment="Right" Margin="0,36,4,8" Width="263" CommandButtonsVisibility="Add,Commit,Cancel,Delete,Navigation" AutoGenerateFields="False" 
							AutoEdit="True" AutoCommit="False" EditEnding="EditEndingLookup" EditEnded="EditEnded"
							Header="" DeletingItem="DeleteCNAM">
							<toolkit:DataForm.EditTemplate>
								<DataTemplate>
									<StackPanel>
										<TextBlock Text="Incoming Number" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupKey, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Caller Name" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding LookupValue, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" />
										</toolkit:DataField>
										<TextBlock Text="Description" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
										<toolkit:DataField Label="">
											<TextBox Height="50" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding Description, Mode=TwoWay}"
												VerticalAlignment="Top" Width="220" TextWrapping="Wrap"/>
										</toolkit:DataField>
									</StackPanel>
								</DataTemplate>
							</toolkit:DataForm.EditTemplate>
						</toolkit:DataForm>
					</Grid>
				</sdk:TabItem>
				<sdk:TabItem Header="Options">
						<Grid Background="Black">
							<toolkit:DataForm x:Name="m_optionsDataForm" Margin="8" CommandButtonsVisibility="Commit,Cancel" AutoGenerateFields="False" 
								AutoEdit="True" AutoCommit="False" EditEnded="EditEnded"
								Header="Dial Plan Options">
								<toolkit:DataForm.EditTemplate>
									<DataTemplate>
										<StackPanel>
											<!--<TextBlock Text="Time Zone" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<ComboBox Height="23" x:Name="m_timezonesList" HorizontalAlignment="Left" Margin="0,0,0,0" SelectedValue="{Binding Timezone, Mode=TwoWay}" VerticalAlignment="Top" />
											</toolkit:DataField>-->
											<TextBlock Text="Country Code" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding CountryCode, Mode=TwoWay}"
													VerticalAlignment="Top" Width="80" />
											</toolkit:DataField>
											<TextBlock Text="Area Code" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding AreaCode, Mode=TwoWay}"
													VerticalAlignment="Top" Width="80" />
											</toolkit:DataField>
											<TextBlock Text="Enable Safeguards" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<CheckBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" IsChecked="{Binding EnableSafeguards, Mode=TwoWay}"
													VerticalAlignment="Top" Width="200" />
											</toolkit:DataField>
											<TextBlock Text="Allowed Country Codes" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding AllowedCountryCodes, Mode=TwoWay}"
													VerticalAlignment="Top" Width="400" />
											</toolkit:DataField>
											<TextBlock Text="Excluded Prefixes" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="80" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ExcludedPrefixes, Mode=TwoWay}"
													VerticalAlignment="Top" Width="400" TextWrapping="NoWrap" AcceptsReturn="True"/>
											</toolkit:DataField>
											<TextBlock Text="ENUM Servers" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="80" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding ENUMServers, Mode=TwoWay}"
													VerticalAlignment="Top" Width="400" TextWrapping="NoWrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
											</toolkit:DataField>
											<TextBlock Text="White Pages Key" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" />
											<toolkit:DataField Label="">
												<TextBox Height="23" HorizontalAlignment="Left" Margin="0,0,0,0" Text="{Binding WhitePagesKey, Mode=TwoWay}"
													VerticalAlignment="Top" Width="400" />
											</toolkit:DataField>
										</StackPanel>
									</DataTemplate>
								</toolkit:DataForm.EditTemplate>
							</toolkit:DataForm>
						</Grid>	
				</sdk:TabItem>
			</sdk:TabControl>
		</StackPanel>
	</Border>
</UserControl>